package io.renren.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.constant.DeleteConstant;
import io.renren.common.entity.GoodsInfoEntity;
import io.renren.common.utils.PageUtils;
import io.renren.dao.GoodsDao;
import io.renren.dto.GoodsInfoQueryDto;
import io.renren.service.ApiGoodsInfoService;
import org.springframework.stereotype.Service;



/**
 * @author JinYang
 * @version 1.0
 * @belongsProject supermarket-management-system
 * @belongsPackage io.renren.service.impl
 * @createTime 2024-08-14  15:05
 * @description TODO
 */
@Service
public class ApiGoodsInfoServiceImpl extends ServiceImpl<GoodsDao, GoodsInfoEntity> implements ApiGoodsInfoService {


    @Override
    public PageUtils queryPage(GoodsInfoQueryDto goodsInfoQueryDto) {
        Page<GoodsInfoEntity> page = new Page<>(goodsInfoQueryDto.getPage(), goodsInfoQueryDto.getPageSize());
        QueryWrapper<GoodsInfoEntity> wrapper = new QueryWrapper<GoodsInfoEntity>()
                .gt("update_time", goodsInfoQueryDto.getUpdateTime())
                .eq("delete_state",DeleteConstant.NOT_DELETE);
        IPage<GoodsInfoEntity> page1 = baseMapper.selectPage(page, wrapper);
        return new PageUtils(page1);
    }
}

